{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>工作日上班时间人均停留时间</th>\n",
       "      <th>凌晨人均停留时间</th>\n",
       "      <th>周末人均停留时间</th>\n",
       "      <th>日均人流量</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>基站编号</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>36902</th>\n",
       "      <td>0.103865</td>\n",
       "      <td>0.856364</td>\n",
       "      <td>0.850539</td>\n",
       "      <td>0.169153</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36903</th>\n",
       "      <td>0.263285</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.725732</td>\n",
       "      <td>0.118210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36904</th>\n",
       "      <td>0.144928</td>\n",
       "      <td>0.740000</td>\n",
       "      <td>0.644068</td>\n",
       "      <td>0.038909</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36905</th>\n",
       "      <td>0.082126</td>\n",
       "      <td>0.992727</td>\n",
       "      <td>0.993837</td>\n",
       "      <td>0.020031</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36906</th>\n",
       "      <td>0.374396</td>\n",
       "      <td>0.867273</td>\n",
       "      <td>0.987673</td>\n",
       "      <td>0.102217</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36907</th>\n",
       "      <td>0.159420</td>\n",
       "      <td>0.641818</td>\n",
       "      <td>0.647149</td>\n",
       "      <td>0.138158</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36908</th>\n",
       "      <td>0.268116</td>\n",
       "      <td>0.660000</td>\n",
       "      <td>0.593220</td>\n",
       "      <td>0.145083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36909</th>\n",
       "      <td>0.212560</td>\n",
       "      <td>0.949091</td>\n",
       "      <td>0.898305</td>\n",
       "      <td>0.089523</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36910</th>\n",
       "      <td>0.193237</td>\n",
       "      <td>0.954545</td>\n",
       "      <td>0.950693</td>\n",
       "      <td>0.010057</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36911</th>\n",
       "      <td>0.142512</td>\n",
       "      <td>0.774545</td>\n",
       "      <td>0.936826</td>\n",
       "      <td>0.127030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36912</th>\n",
       "      <td>0.338164</td>\n",
       "      <td>0.705455</td>\n",
       "      <td>0.657935</td>\n",
       "      <td>0.004122</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35138</th>\n",
       "      <td>0.340580</td>\n",
       "      <td>0.776364</td>\n",
       "      <td>0.679507</td>\n",
       "      <td>0.126535</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37337</th>\n",
       "      <td>0.171498</td>\n",
       "      <td>0.778182</td>\n",
       "      <td>0.983051</td>\n",
       "      <td>0.043442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36181</th>\n",
       "      <td>0.301932</td>\n",
       "      <td>0.805455</td>\n",
       "      <td>0.744222</td>\n",
       "      <td>0.105103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38231</th>\n",
       "      <td>0.311594</td>\n",
       "      <td>0.940000</td>\n",
       "      <td>0.753467</td>\n",
       "      <td>0.135521</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38015</th>\n",
       "      <td>0.147343</td>\n",
       "      <td>0.887273</td>\n",
       "      <td>0.902928</td>\n",
       "      <td>0.012283</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38953</th>\n",
       "      <td>0.012077</td>\n",
       "      <td>0.761818</td>\n",
       "      <td>0.688752</td>\n",
       "      <td>0.020443</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35390</th>\n",
       "      <td>0.149758</td>\n",
       "      <td>0.689091</td>\n",
       "      <td>0.593220</td>\n",
       "      <td>0.159097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36453</th>\n",
       "      <td>0.144928</td>\n",
       "      <td>0.785455</td>\n",
       "      <td>0.661017</td>\n",
       "      <td>0.090842</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36855</th>\n",
       "      <td>0.299517</td>\n",
       "      <td>0.916364</td>\n",
       "      <td>0.662558</td>\n",
       "      <td>0.140467</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35924</th>\n",
       "      <td>0.275362</td>\n",
       "      <td>0.665455</td>\n",
       "      <td>0.787365</td>\n",
       "      <td>0.136510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35988</th>\n",
       "      <td>0.243961</td>\n",
       "      <td>0.901818</td>\n",
       "      <td>0.916795</td>\n",
       "      <td>0.175748</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37537</th>\n",
       "      <td>0.132850</td>\n",
       "      <td>0.860000</td>\n",
       "      <td>0.714946</td>\n",
       "      <td>0.027121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38885</th>\n",
       "      <td>0.193237</td>\n",
       "      <td>0.734545</td>\n",
       "      <td>0.922958</td>\n",
       "      <td>0.036271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36797</th>\n",
       "      <td>0.282609</td>\n",
       "      <td>0.670909</td>\n",
       "      <td>0.657935</td>\n",
       "      <td>0.147226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35976</th>\n",
       "      <td>0.026570</td>\n",
       "      <td>0.723636</td>\n",
       "      <td>0.570108</td>\n",
       "      <td>0.125216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37377</th>\n",
       "      <td>0.041063</td>\n",
       "      <td>0.989091</td>\n",
       "      <td>0.648690</td>\n",
       "      <td>0.155634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37160</th>\n",
       "      <td>0.260870</td>\n",
       "      <td>0.743636</td>\n",
       "      <td>0.969183</td>\n",
       "      <td>0.165279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38717</th>\n",
       "      <td>0.173913</td>\n",
       "      <td>0.821818</td>\n",
       "      <td>0.580894</td>\n",
       "      <td>0.111203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38608</th>\n",
       "      <td>0.270531</td>\n",
       "      <td>0.749091</td>\n",
       "      <td>0.694915</td>\n",
       "      <td>0.115984</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36926</th>\n",
       "      <td>0.154589</td>\n",
       "      <td>0.080000</td>\n",
       "      <td>0.041602</td>\n",
       "      <td>0.523452</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38769</th>\n",
       "      <td>0.152174</td>\n",
       "      <td>0.087273</td>\n",
       "      <td>0.203390</td>\n",
       "      <td>0.799439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35058</th>\n",
       "      <td>0.202899</td>\n",
       "      <td>0.074545</td>\n",
       "      <td>0.231125</td>\n",
       "      <td>0.633419</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36928</th>\n",
       "      <td>0.111111</td>\n",
       "      <td>0.010909</td>\n",
       "      <td>0.100154</td>\n",
       "      <td>0.908334</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37399</th>\n",
       "      <td>0.060386</td>\n",
       "      <td>0.043636</td>\n",
       "      <td>0.183359</td>\n",
       "      <td>0.828703</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38631</th>\n",
       "      <td>0.159420</td>\n",
       "      <td>0.087273</td>\n",
       "      <td>0.164869</td>\n",
       "      <td>0.447119</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38174</th>\n",
       "      <td>0.173913</td>\n",
       "      <td>0.081818</td>\n",
       "      <td>0.261941</td>\n",
       "      <td>0.499382</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37439</th>\n",
       "      <td>0.099034</td>\n",
       "      <td>0.085455</td>\n",
       "      <td>0.340524</td>\n",
       "      <td>0.917484</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35365</th>\n",
       "      <td>0.147343</td>\n",
       "      <td>0.080000</td>\n",
       "      <td>0.243451</td>\n",
       "      <td>0.995961</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36427</th>\n",
       "      <td>0.118357</td>\n",
       "      <td>0.012727</td>\n",
       "      <td>0.204931</td>\n",
       "      <td>0.822933</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36054</th>\n",
       "      <td>0.125604</td>\n",
       "      <td>0.036364</td>\n",
       "      <td>0.379045</td>\n",
       "      <td>0.653203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37867</th>\n",
       "      <td>0.178744</td>\n",
       "      <td>0.041818</td>\n",
       "      <td>0.114022</td>\n",
       "      <td>0.573572</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37102</th>\n",
       "      <td>0.077295</td>\n",
       "      <td>0.072727</td>\n",
       "      <td>0.255778</td>\n",
       "      <td>0.699695</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35835</th>\n",
       "      <td>0.077295</td>\n",
       "      <td>0.041818</td>\n",
       "      <td>0.342065</td>\n",
       "      <td>0.574561</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35226</th>\n",
       "      <td>0.200483</td>\n",
       "      <td>0.056364</td>\n",
       "      <td>0.015408</td>\n",
       "      <td>0.946830</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36484</th>\n",
       "      <td>0.106280</td>\n",
       "      <td>0.016364</td>\n",
       "      <td>0.120185</td>\n",
       "      <td>0.956640</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35302</th>\n",
       "      <td>0.161836</td>\n",
       "      <td>0.014545</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.709669</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38206</th>\n",
       "      <td>0.082126</td>\n",
       "      <td>0.081818</td>\n",
       "      <td>0.337442</td>\n",
       "      <td>0.698376</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38943</th>\n",
       "      <td>0.159420</td>\n",
       "      <td>0.065455</td>\n",
       "      <td>0.144838</td>\n",
       "      <td>0.655676</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35723</th>\n",
       "      <td>0.149758</td>\n",
       "      <td>0.007273</td>\n",
       "      <td>0.318952</td>\n",
       "      <td>0.518012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37582</th>\n",
       "      <td>0.171498</td>\n",
       "      <td>0.027273</td>\n",
       "      <td>0.369800</td>\n",
       "      <td>0.528481</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35832</th>\n",
       "      <td>0.096618</td>\n",
       "      <td>0.087273</td>\n",
       "      <td>0.080123</td>\n",
       "      <td>0.727228</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37973</th>\n",
       "      <td>0.183575</td>\n",
       "      <td>0.045455</td>\n",
       "      <td>0.221880</td>\n",
       "      <td>0.825406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35153</th>\n",
       "      <td>0.060386</td>\n",
       "      <td>0.036364</td>\n",
       "      <td>0.007704</td>\n",
       "      <td>0.637375</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36667</th>\n",
       "      <td>0.070048</td>\n",
       "      <td>0.012727</td>\n",
       "      <td>0.241911</td>\n",
       "      <td>0.744704</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35562</th>\n",
       "      <td>0.125604</td>\n",
       "      <td>0.081818</td>\n",
       "      <td>0.291217</td>\n",
       "      <td>0.608771</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38624</th>\n",
       "      <td>0.152174</td>\n",
       "      <td>0.072727</td>\n",
       "      <td>0.354391</td>\n",
       "      <td>0.590718</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36017</th>\n",
       "      <td>0.205314</td>\n",
       "      <td>0.003636</td>\n",
       "      <td>0.129430</td>\n",
       "      <td>0.973539</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38827</th>\n",
       "      <td>0.154589</td>\n",
       "      <td>0.089091</td>\n",
       "      <td>0.118644</td>\n",
       "      <td>0.927129</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37787</th>\n",
       "      <td>0.154589</td>\n",
       "      <td>0.001818</td>\n",
       "      <td>0.329738</td>\n",
       "      <td>0.802984</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>431 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       工作日上班时间人均停留时间  凌晨人均停留时间  周末人均停留时间     日均人流量\n",
       "基站编号                                              \n",
       "36902       0.103865  0.856364  0.850539  0.169153\n",
       "36903       0.263285  1.000000  0.725732  0.118210\n",
       "36904       0.144928  0.740000  0.644068  0.038909\n",
       "36905       0.082126  0.992727  0.993837  0.020031\n",
       "36906       0.374396  0.867273  0.987673  0.102217\n",
       "36907       0.159420  0.641818  0.647149  0.138158\n",
       "36908       0.268116  0.660000  0.593220  0.145083\n",
       "36909       0.212560  0.949091  0.898305  0.089523\n",
       "36910       0.193237  0.954545  0.950693  0.010057\n",
       "36911       0.142512  0.774545  0.936826  0.127030\n",
       "36912       0.338164  0.705455  0.657935  0.004122\n",
       "35138       0.340580  0.776364  0.679507  0.126535\n",
       "37337       0.171498  0.778182  0.983051  0.043442\n",
       "36181       0.301932  0.805455  0.744222  0.105103\n",
       "38231       0.311594  0.940000  0.753467  0.135521\n",
       "38015       0.147343  0.887273  0.902928  0.012283\n",
       "38953       0.012077  0.761818  0.688752  0.020443\n",
       "35390       0.149758  0.689091  0.593220  0.159097\n",
       "36453       0.144928  0.785455  0.661017  0.090842\n",
       "36855       0.299517  0.916364  0.662558  0.140467\n",
       "35924       0.275362  0.665455  0.787365  0.136510\n",
       "35988       0.243961  0.901818  0.916795  0.175748\n",
       "37537       0.132850  0.860000  0.714946  0.027121\n",
       "38885       0.193237  0.734545  0.922958  0.036271\n",
       "36797       0.282609  0.670909  0.657935  0.147226\n",
       "35976       0.026570  0.723636  0.570108  0.125216\n",
       "37377       0.041063  0.989091  0.648690  0.155634\n",
       "37160       0.260870  0.743636  0.969183  0.165279\n",
       "38717       0.173913  0.821818  0.580894  0.111203\n",
       "38608       0.270531  0.749091  0.694915  0.115984\n",
       "...              ...       ...       ...       ...\n",
       "36926       0.154589  0.080000  0.041602  0.523452\n",
       "38769       0.152174  0.087273  0.203390  0.799439\n",
       "35058       0.202899  0.074545  0.231125  0.633419\n",
       "36928       0.111111  0.010909  0.100154  0.908334\n",
       "37399       0.060386  0.043636  0.183359  0.828703\n",
       "38631       0.159420  0.087273  0.164869  0.447119\n",
       "38174       0.173913  0.081818  0.261941  0.499382\n",
       "37439       0.099034  0.085455  0.340524  0.917484\n",
       "35365       0.147343  0.080000  0.243451  0.995961\n",
       "36427       0.118357  0.012727  0.204931  0.822933\n",
       "36054       0.125604  0.036364  0.379045  0.653203\n",
       "37867       0.178744  0.041818  0.114022  0.573572\n",
       "37102       0.077295  0.072727  0.255778  0.699695\n",
       "35835       0.077295  0.041818  0.342065  0.574561\n",
       "35226       0.200483  0.056364  0.015408  0.946830\n",
       "36484       0.106280  0.016364  0.120185  0.956640\n",
       "35302       0.161836  0.014545  0.000000  0.709669\n",
       "38206       0.082126  0.081818  0.337442  0.698376\n",
       "38943       0.159420  0.065455  0.144838  0.655676\n",
       "35723       0.149758  0.007273  0.318952  0.518012\n",
       "37582       0.171498  0.027273  0.369800  0.528481\n",
       "35832       0.096618  0.087273  0.080123  0.727228\n",
       "37973       0.183575  0.045455  0.221880  0.825406\n",
       "35153       0.060386  0.036364  0.007704  0.637375\n",
       "36667       0.070048  0.012727  0.241911  0.744704\n",
       "35562       0.125604  0.081818  0.291217  0.608771\n",
       "38624       0.152174  0.072727  0.354391  0.590718\n",
       "36017       0.205314  0.003636  0.129430  0.973539\n",
       "38827       0.154589  0.089091  0.118644  0.927129\n",
       "37787       0.154589  0.001818  0.329738  0.802984\n",
       "\n",
       "[431 rows x 4 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#-*- utf-8 -*-\n",
    "# 离差标准化（最大最小规范化）：保留了原来数据中存在的关系，消除梁刚和数据取值范围影响最简单的方法\n",
    "# 目标：消除数量级数据带来的影响，数据标准化到[0,1]\n",
    "import pandas as pd\n",
    "\n",
    "filename = 'business_circle.xls'\n",
    "data = pd.read_excel(filename, index_col = u'基站编号')\n",
    "data = (data - data.min()) / (data.max() - data.min()) # 离差标准化\n",
    "data.to_excel('1_1standardization.xlsx')\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
